Active-active system index management

ABSTRACT

A computer-implemented method for managing an index table associated with a data table includes obtaining an index entry associated with a key in the data table. The computer-implemented method further includes determining whether an index page associated with the index entry is in a buffer pool, wherein the buffer pool includes a plurality of index pages loaded from the index table and at least one temp index. The computer-implemented method further includes adding, in response to determining that the index page associated with the index entry is not in the buffer pool, the index entry into the at least one temp index. The computer-implemented method further includes consolidating the at least one temp index into the index table.

BACKGROUND

The present invention relates to computer technology, and morespecifically, to a computer-implemented method, computer system andcomputer program product for managing an index table associated with adata table.

Nowadays databases are widely used in many applications, such as forbusiness or academic purposes to manage large amounts of data. Within adatabase, data may be stored in data tables. In some instances, the sizeof a data table may be of a predetermined size. In other instances, thesize of a data table may be based on an amount of data to be arrangedand stored in the table. Regardless, since the size of a data table cangrow to be considerably large, data retrieval in the data table mayconsume a lot of computing resources if a whole table scan is performed.

SUMMARY

According to one embodiment of the present invention, acomputer-implemented method for managing an index table associated witha data table is disclosed. The computer-implemented method includesobtaining an index entry associated with a key in the data table. Thecomputer-implemented method further includes determining whether anindex page associated with the index entry is in a buffer pool, whereinthe buffer pool includes a plurality of index pages loaded from theindex table and at least one temp index. The computer-implemented methodfurther includes adding, in response to determining that the index pageassociated with the index entry is not in the buffer pool, the indexentry into the at least one temp index. The computer-implemented methodfurther includes consolidating the at least one temp index into theindex table.

According to another embodiment of the present invention, a computersystem for managing an index table associated with a data table isdisclosed. The computer system includes one or more computer processors,one or more computer readable storage media, and program instructionsstored on the computer readable storage media for execution by at leastone of the one or more processors. The program instructions includeinstructions to obtain an index entry associated with a key in the datatable. The program instructions further include instructions todetermine whether an index page associated with the index entry is in abuffer pool, wherein the buffer pool includes a plurality of index pagesloaded from the index table and at least one temp index. The programinstructions further include instructions to add, in response todetermining that the index page associated with the index entry is notin the buffer pool, the index entry into the at least one temp index.The program instructions further include instructions to consolidate theat least one temp index into the index table.

According to another embodiment of the present invention, a computerprogram product for managing an index table associated with a data tableis disclosed. The computer program product includes one or more computerreadable storage media and program instructions stored on the one ormore computer readable storage media. The program instructions includeinstructions to obtain an index entry associated with a key in the datatable. The program instructions further include instructions todetermine whether an index page associated with the index entry is in abuffer pool, wherein the buffer pool includes a plurality of index pagesloaded from the index table and at least one temp index. The programinstructions further include instructions to add, in response todetermining that the index page associated with the index entry is notin the buffer pool, the index entry into the at least one temp index.The program instructions further include instructions to consolidate theat least one temp index into the index table.

BRIEF DESCRIPTION OF THE DRAWINGS

The drawings included in the present application are incorporated into,and form part of, the specification. They illustrate embodiments of thepresent disclosure and, along with the description, serve to explain theprinciples of the disclosure. The drawings are only illustrative ofcertain embodiments and do not limit the disclosure. The same referencenumbers used throughout the drawings shall generally refer to the samecomponents in the various embodiments of the present disclosure.

FIG. 1 depicts a cloud computing environment in accordance with at leastone embodiment of the present invention.

FIG. 2 depicts abstraction model layers in accordance with at least oneembodiment of the present invention.

FIG. 3 depicts a cloud computing node in accordance with at least oneembodiment of the present invention.

FIG. 4 depicts a schematic flowchart of a method for managing an indextable associated with a data table in accordance with at least oneembodiment of the present invention.

FIG. 5 depicts an example of a standby database in a log-based datareplication scenario in accordance with at least one embodiment of thepresent invention.

FIG. 6 depicts an exemplary buffer pool of the standby database of FIG.5 in accordance with at least one embodiment of the present invention.

FIG. 7 depicts a schematic flowchart of a method for consolidating theat least one temp index into the index table of FIG. 4 in accordancewith at least one embodiment of the present invention.

DETAILED DESCRIPTION

In accordance with various embodiments of the present invention, inorder to facilitate data retrieval in a data table, one or more indextables may be created for one or more columns of the data table. Forexample, data (or values) in one column of the data table may be used askeys for creating an associated index table. The index table includes aplurality of index entries, each of which contains a key and a row ID(RID) indicating a row address of the key in the data table. The indexentries in the index table are arranged in ascending order or descendingorder of their keys, such that searching for a target key in the indextable will consume fewer computing resources than searching for thetarget key in the data table at random. After the target key isretrieved from the index table, an RID associated with the target key isutilized to find a corresponding row in the data table.

Embodiments of the present invention recognize that an improvement inindex management can be made to various types of applications where adatabase is utilized. For example, in a log-based data replicationscenario where a primary database and a standby database are bothactive, continuous availability of data can be provided formission-critical businesses. However, if a large number of random keysneed to be copied from the primary database to the standby database, thestandby database may result in performance degradation, such asincreased system latency due to current index management solutions.

During index management in accordance with embodiments of the presentinvention, data in one column of the data table may be used as keys forcreating the index table, as described above. In this way, the indextable is associated with the data table. If a key is inserted into theone column of the data table, an index entry including the key isrequired to be inserted into the index table. Similarly, if a key in theone column of the data table is deleted or updated, the index entryassociated with the key is required to be deleted from or updated in theindex table. To perform the action of inserting, deleting, or updatingthe index entry, an index page associated with the index entry may beloaded into a buffer pool. Each index page is a basic unit for assigningstorage space for index entries. The index entries may be arranged inthe respective index pages according to their keys, which means theassociations between the index entries and the index pages may bedetermined based on their keys. After the index page associated with theindex entry is loaded into the buffer pool, the index entry is insertedinto, deleted from, or updated in the index page in the buffer pool.

When a large number of random keys are associated with various indexpages, all of the index pages may not be able to reside in the bufferpool at the same time. In this scenario, index pages may be required tobe frequently loaded into the buffer pool. However, embodiments of thepresent invention recognize that the frequent loading of index pagesinto the buffer pool can cause increased latency for operationsperformed between the primary database and standby database. Thisincreased latency can result in the standby database becoming out ofsync with the primary database, which ultimately can result in aninability to recover the most current versions of data from the standbydatabase during disaster recovery.

Accordingly, embodiments of the present invention provide for animproved method for managing an index table that reduces latency foroperations performed between a primary database and a standby databasein an active-active configuration when a large number of random keys areassociated with various index pages.

The present invention may be a system, a method, and/or a computerprogram product at any possible technical detail level of integration.The computer program product may include a computer readable storagemedium (or media) having computer readable program instructions thereonfor causing a processor to carry out aspects of the present invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suit-able combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, or either source code or object code written in anycombination of one or more programming languages, including an objectoriented programming language such as Smalltalk, C++ or the like, andconventional procedural programming languages, such as the “C”programming language or similar programming languages. The computerreadable program instructions may execute entirely on the user'scomputer, partly on the user's computer, as a stand-alone softwarepackage, partly on the user's computer and partly on a remote computeror entirely on the remote computer or server. In the latter scenario,the remote computer may be connected to the user's computer through anytype of network, including a local area network (LAN) or a wide areanetwork (WAN), or the connection may be made to an external computer(for example, through the Internet using an Internet Service Provider).In some embodiments, electronic circuitry including, for example,programmable logic circuitry, field-programmable gate arrays (FPGA), orprogrammable logic arrays (PLA) may execute the computer readableprogram instructions by utilizing state information of the computerreadable program instructions to personalize the electronic circuitry,in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general-purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the block may occur out of theorder noted in the figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

The descriptions of the various embodiments of the present inventionhave been presented for purposes of illustration, but are not intendedto be exhaustive or limited to the embodiments disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the describedembodiments. The terminology used herein was chosen to best explain theprinciples of the embodiments, the practical application or technicalimprovement over technologies found in the marketplace, or to enableothers of ordinary skill in the art to understand the embodimentsdisclosed herein.

It is to be understood that although this disclosure includes a detaileddescription on cloud computing, implementation of the teachings recitedherein are not limited to a cloud computing environment. Rather,embodiments of the present invention are capable of being implemented inconjunction with any other type of computing environment now known orlater developed.

Cloud computing is a model of service delivery for enabling convenient,on-demand network access to a shared pool of configurable computingresources (e.g. networks, network bandwidth, servers, processing,memory, storage, applications, virtual machines, and services) that canbe rapidly provisioned and released with minimal management effort orinteraction with a provider of the service. This cloud model may includeat least five characteristics, at least three service models, and atleast four deployment models.

Characteristics are as follows:

On-demand self-service: a cloud consumer can unilaterally provisioncomputing capabilities, such as server time and network storage, asneeded automatically without requiring human interaction with theservice's provider.

Broad network access: capabilities are available over a network andaccessed through standard mechanisms that promote use by heterogeneousthin or thick client platforms (e.g., mobile phones, laptops, and PDAs).

Resource pooling: the provider's computing resources are pooled to servemultiple consumers using a multi-tenant model, with different physicaland virtual resources dynamically assigned and reassigned according todemand. There is a sense of location independence in that the consumergenerally has no control or knowledge over the exact location of theprovided resources but may be able to specify location at a higher levelof abstraction (e.g., country, state, or datacenter).

Rapid elasticity: capabilities can be rapidly and elasticallyprovisioned, in some cases automatically, to quickly scale out andrapidly released to quickly scale in. To the consumer, the capabilitiesavailable for provisioning often appear to be unlimited and can bepurchased in any quantity at any time.

Measured service: cloud systems automatically control and optimizeresource use by leveraging a metering capability at some level ofabstraction appropriate to the type of service (e.g., storage,processing, bandwidth, and active user accounts). Resource usage can bemonitored, controlled, and reported providing transparency for both theprovider and consumer of the utilized service.

Service Models are as follows:

Software as a Service (SaaS): the capability provided to the consumer isto use the provider's applications running on a cloud infrastructure.The applications are accessible from various client devices through athin client interface such as a web browser (e.g., web-based e-mail).The consumer does not manage or control the underlying cloudinfrastructure including network, servers, operating systems, storage,or even individual application capabilities, with the possible exceptionof limited user-specific application configuration settings.

Platform as a Service (PaaS): the capability provided to the consumer isto deploy onto the cloud infrastructure consumer-created or acquiredapplications created using programming languages and tools supported bythe provider. The consumer does not manage or control the underlyingcloud infrastructure including networks, servers, operating systems, orstorage, but has control over the deployed applications and possiblyapplication hosting environment configurations.

Infrastructure as a Service (IaaS): the capability provided to theconsumer is to provision processing, storage, networks, and otherfundamental computing resources where the consumer is able to deploy andrun arbitrary software, which can include operating systems andapplications. The consumer does not manage or control the underlyingcloud infrastructure but has control over operating systems, storage,deployed applications, and possibly limited control of select networkingcomponents (e.g., host firewalls).

Deployment Models are as follows:

Private cloud: the cloud infrastructure is operated solely for anorganization. It may be managed by the organization or a third party andmay exist on-premises or off-premises.

Community cloud: the cloud infrastructure is shared by severalorganizations and supports a specific community that has shared concerns(e.g., mission, security requirements, policy, and complianceconsiderations). It may be managed by the organizations or a third partyand may exist on-premises or off-premises.

Public cloud: the cloud infrastructure is made available to the generalpublic or a large industry group and is owned by an organization sellingcloud services.

Hybrid cloud: the cloud infrastructure is a composition of two or moreclouds (private, community, or public) that remain unique entities butare bound together by standardized or proprietary technology thatenables data and application portability (e.g., cloud bursting forload-balancing between clouds).

A cloud computing environment is service oriented with a focus onstatelessness, low coupling, modularity, and semantic interoperability.At the heart of cloud computing is an infrastructure that includes anetwork of interconnected nodes.

Referring now to FIG. 1, a cloud computing environment in accordancewith at least one embodiment of the present invention is depicted. Cloudcomputing environment 50 includes one or more cloud computing nodes 10with which local computing devices used by cloud consumers, such as, forexample, personal digital assistant (PDA) or cellular telephone 54A,desktop computer 54B, laptop computer 54C, and/or automobile computersystem 54N may communicate. Cloud computing nodes 10 may communicatewith one another. They may be grouped (not shown) physically orvirtually, in one or more networks, such as Private, Community, Public,or Hybrid clouds as described hereinabove, or a combination thereof.This allows cloud computing environment 50 to offer infrastructure,platforms and/or software as services for which a cloud consumer doesnot need to maintain resources on a local computing device. It isunderstood that the types of computing devices 54A-N shown in FIG. 1 areintended to be illustrative only and that cloud computing nodes 10 andcloud computing environment 50 can communicate with any type ofcomputerized device over any type of network and/or network addressableconnection (e.g., using a web browser).

Referring now to FIG. 2, a set of functional abstraction layers providedby cloud computing environment 50 (shown in FIG. 1) is depicted. Itshould be understood in advance that the components, layers, andfunctions shown in FIG. 2 are intended to be illustrative only andembodiments of the invention are not limited thereto. As depicted, thefollowing layers and corresponding functions are provided:

Hardware and software layer 60 includes hardware and softwarecomponents. Examples of hardware components include: mainframes 61; RISC(Reduced Instruction Set Computer) architecture based servers 62;servers 63; blade servers 64; storage devices 65; and networks andnetworking components 66. In some embodiments, software componentsinclude network application server software 67 and database software 68.

Virtualization layer 70 provides an abstraction layer from which thefollowing examples of virtual entities may be provided: virtual servers71; virtual storage 72; virtual networks 73, including virtual privatenetworks; virtual applications and operating systems 74; and virtualclients 75.

In one example, management layer 80 may provide the functions describedbelow. Resource provisioning 81 provides dynamic procurement ofcomputing resources and other resources that are utilized to performtasks within the cloud computing environment. Metering and Pricing 82provide cost tracking as resources are utilized within the cloudcomputing environment, and billing or invoicing for consumption of theseresources. In one example, these resources may include applicationsoftware licenses. Security provides identity verification for cloudconsumers and tasks, as well as protection for data and other resources.User portal 83 provides access to the cloud computing environment forconsumers and system administrators. Service level management 84provides cloud computing resource allocation and management such thatrequired service levels are met. Service Level Agreement (SLA) planningand fulfillment 85 provide pre-arrangement for, and procurement of,cloud computing resources for which a future requirement is anticipatedin accordance with an SLA.

Workloads layer 90 provides examples of functionality for which thecloud computing environment may be utilized. Examples of workloads andfunctions which may be provided from this layer include: mapping andnavigation 91; software development and lifecycle management 92; virtualclassroom education delivery 93; data analytics processing 94;transaction processing 95; and index management 96.

Referring now to FIG. 3, a computing device 300 of cloud computing node10 (depicted in FIG. 1) in accordance with at least one embodiment ofpresent invention is disclosed. It should be appreciated that FIG. 3provides only an illustration of one implementation and does not implyany limitations with regard to the environments in which differentembodiments may be implemented. Many modifications to the depictedenvironment may be made.

As depicted in FIG. 3, computing device 300 of cloud computing node 10includes communications fabric 302, which provides communicationsbetween computer processor(s) 304, memory 306, persistent storage 308,communications unit 310, and input/output (I/O) interface(s) 312.Communications fabric 302 can be implemented with any architecturedesigned for passing data and/or control information between processors(such as microprocessors, communications and network processors, etc.),system memory, peripheral devices, and any other hardware componentswithin a system. For example, communications fabric 302 can beimplemented with one or more buses.

Memory 306 and persistent storage 308 are computer-readable storagemedia. In this embodiment, memory 306 includes random access memory(RAM) 314 and cache memory 316. In general, memory 306 can include anysuitable volatile or non-volatile computer-readable storage media.

Program/utility 322, having one or more program modules 324 are storedin persistent storage 308 for execution and/or access by one or more ofthe respective computer processors 304 via one or more memories ofmemory 306. Program modules 324 generally carry out the functions and/ormethodologies of embodiments of the present invention as describedherein. In an embodiment, persistent storage 308 includes a magnetichard disk drive. Alternatively, or in addition to a magnetic hard diskdrive, persistent storage 308 can include a solid state hard drive, asemiconductor storage device, read-only memory (ROM), erasableprogrammable read-only memory (EPROM), flash memory, or any othercomputer-readable storage media that is capable of storing programinstructions or digital information.

The media used by persistent storage 308 may also be removable. Forexample, a removable hard drive may be used for persistent storage 308.Other examples include optical and magnetic disks, thumb drives, andsmart cards that are inserted into a drive for transfer onto anothercomputer-readable storage medium that is also part of persistent storage308.

Communications unit 310, in these examples, provides for communicationswith other data processing systems or devices, including resources ofcloud computing environment 50. In these examples, communications unit310 includes one or more network interface cards. Communications unit310 may provide communications through the use of either or bothphysical and wireless communications links. Program modules 324 may bedownloaded to persistent storage 308 through communications unit 310.

I/O interface(s) 312 allows for input and output of data with otherdevices that may be connected to computing device 300. For example, I/Ointerface 312 may provide a connection to external devices 318 such as akeyboard, keypad, a touch screen, and/or some other suitable inputdevice. External devices 318 can also include portable computer-readablestorage media such as, for example, thumb drives, portable optical ormagnetic disks, and memory cards. Software and data used to practiceembodiments of the present invention, e.g., program modules 324, can bestored on such portable computer-readable storage media and can beloaded onto persistent storage 308 via I/O interface(s) 312. I/Ointerface(s) 312 also connect to a display 320.

Display 320 provides a mechanism to display data to a user and may be,for example, a computer monitor, or a television screen.

The programs described herein are identified based upon the applicationfor which they are implemented in a specific embodiment of theinvention. However, it should be appreciated that any particular programnomenclature herein is used merely for convenience, and thus theinvention should not be limited to use solely in any specificapplication identified and/or implied by such nomenclature.

Referring now to FIG. 4, a schematic flowchart of a method 400 formanaging an index table associated with a data table in accordance withat least one embodiment of the present invention is depicted. At step402, an index entry associated with a key in the data table is obtained.The index entry may include the key, an RID indicating a row address ofthe key in the data table, and a flag indicating availability of theindex entry. The index entry may be obtained in response, but notlimited to, one or more of the following: a key being inserted into thedata table at a row address; the key at a row address being deleted fromthe data table; and a key replacing a current key at a row address inthe data table.

In a log-based replication scenario, the index entry may be obtained byexecuting one of a plurality of statements in a received log by astandby database. Referring now to FIG. 5, an example of a standbydatabase 500 in a log-based data replication scenario in accordance withat least one embodiment of the present invention is disclosed. Asdepicted in FIG. 5, a log 502 may be received by a standby database 500.For example, log 502 is sent from a primary database (not depicted) tostandby database 500. Then, a plurality of statements 504 may be read orparsed from log 502. Prior to executing any of the plurality ofstatements 504 to obtain an index entry, the plurality of statements 504may be stored (as shown by arrow {circle around (1)}) in a storagedevice 509 of standby database 500 for backup. In case of system outage,the stored plurality of statements 504 may be used for system recovery.

Returning back to FIG. 4, at step 404, a determination is made as towhether an index page associated with the index entry is in a bufferpool. Referring now to FIG. 5, a buffer pool 506 may include a pluralityof index pages 520 loaded from an index table 530 in storage device 509.Index table 530 may be associated with the data table 540 in storagedevice 509. In an embodiment, the number of index pages 520 that can beloaded is predefined, for example, based on a storage capacity of thebuffer pool 506. Buffer pool 506 may further include at least onetemporary index (hereinafter referred to as a temp index), in which eachtemp index may be in the form of a B−tree or a B+ tree. In the exemplarystandby database of FIG. 5, only a first temp index 511 and a secondtemp index 512 are shown. However, it should be appreciated that asingle temp index (e.g., first temp index 511) or multiple temp indexesmay be used in accordance with various embodiments of the presentinvention. In an embodiment, temp indexes may be created for indexentries whose associated index pages have low hit ratios and/or shortresidency times since such index pages may need to be loaded into thebuffer pool more frequently.

Returning back to FIG. 4, if a determination is made that the index pageassociated with the index entry is in the buffer pool (decision step 404“Y” branch), then the index entry is added into its associated indexpage at step 406. For example, if it is determined that index page 520associated with index entry 508 is in buffer pool 506 (as shown by arrow{circle around (2)} in FIG. 5), then index entry 508 may be added intoits associated index page 520.

However, if it is determined that the index page associated with theindex entry is not in the buffer pool (decision step 404 “N” branch),then the index entry is added into at least one temp index at step 408.For example, if index page 520 associated with index entry 508 is not inbuffer pool 506 (as shown by dotted arrow {circle around (3)} in FIG.5), then index entry 508 may be added into first temp index 511 if anavailable storage capacity of first temp index 511 is above apredetermined threshold. However, if an available storage capacity offirst temp index 511 is below a predetermined threshold, then indexentry 508 may be added (as shown by arrow {circle around (4)} in FIG. 5)into second temp index 512.

As mentioned above, the index entry may be obtained in response to areplacement key or new key replacing a current key at a row address inthe data table, which means the current key at the row address in thedata table may be required to be updated. In this case, in the processof adding the index entry into the at least one temp index, the indexentry may be divided into a first index entry and a second index entry.The first index entry may include the current key, the RID, and a firstflag indicating the first index entry being unavailable or invalid.Similarly, the second index entry may include the replacement or newkey, the RID, and a second flag indicating the second index entry beingavailable or valid. In this scenario, the first index entry is addedinto a temp index before the second index entry is added into the sametemp index.

In an embodiment, at least one temp index may be designated to onlystore index entries to be deleted from the index table and at least oneother temp index may be designated to only store index entries to beadded into the index table. For example, a first specific temp index mayinclude an indicator indicating index entries are to be added to theindex table. In this case, if the index entry is obtained in response tothe key being inserted into the data table at the row address, the indexentry may be added into the first specific temp index. Similarly, asecond specific temp index may include an indicator indicating indexentries therein that are to be deleted from the index table. In thiscase, if the index entry is obtained in response to the key at the rowaddress being deleted from the data table, the index entry may be addedinto the second specific temp index.

In an embodiment, a first portion of a temp index may be designated toonly store index entries to be deleted from the index table and a secondportion of the temp index may be designated to only store index entriesto be added into the index table. For example, a first portion of aspecific temp index may include an indicator indicating index entriesare to be added to the index table. In this case, if the index entry isobtained in response to the key being inserted into the data table atthe row address, the index entry may be added into the first portion ofthe specific temp index. Similarly, a second portion of the specifictemp index may include an indicator indicating index entries thereinthat are to be deleted from the index table. In this case, if the indexentry is obtained in response to the key at the row address beingdeleted from the data table, the index entry may be added into thesecond portion of the specific temp index.

In an embodiment, if the index entry being obtained is in response to anew or replacement key replacing a current key at the row address in thedata table, the index entry may be divided into a first index entry anda second index entry. The first index entry may include the current key,the RID, and a first flag indicating the first index entry beingunavailable or invalid. The second index entry may include the new orreplacement key, the RID, and a second flag indicating the second indexentry being available or valid. In an embodiment, the first index entrymay be added into the first specific temp index and the second indexentry may be added into the second specific temp index.

Returning to FIG. 4, at step 410, the at least one temp index isconsolidated with the index table. For example, first temp index 511 isconsolidated with index table 530 (as shown by arrow {circle around (5)}in FIG. 5) if first temp index 511 reaches and/or exceeds apredetermined available storage capacity threshold. Here, second tempindex 512 may be used to accommodate subsequent index entries duringconsolidation of first temp index 511 with index table 530. Afterconsolidation, whereby index entries included in first temp index 511are transferred to the index table (e.g., index table 530), indexentries are deleted (e.g., index entries are deleted from first tempindex 511) to thereby free up storage space on first temp index 511.Similarly, if second temp index 512 reaches and/or exceeds apredetermined available storage capacity threshold, second temp index512 may be consolidated with index table 530, and first temp index 511may be used for accommodating subsequent index entries duringconsolidation of second temp index 512 with index table 530.

From the above, if an index page associated with an index entry is notin the buffer pool, the method 400 may temporarily keep the obtainedindex entries in at least one temp index, and consolidate at least onetemp index (containing the index entries included in index pages not inthe buffer pool) into the index table at a later point in time. In thisway, when any index entry is obtained, its associated index page may notneed to be loaded into the buffer pool immediately. Therefore, thefrequency of loading index pages into the buffer pool may be reduced,thus avoiding increased latency when performing operations between aprimary database and a standby database.

Although only first temp index 511 and second temp index 512 aredepicted in FIG. 5, fewer than or more than two temp indexes may beused. In the case of more than two temp indexes being employed, the keysin the temp indexes may be random, and the key ranges of two or moretemp indexes may partially overlap.

Referring now to FIG. 6, an exemplary buffer pool of standby database500 of FIG. 5 in accordance with at least one embodiment of the presentinvention is depicted. More particularly, FIG. 6 illustrates a scenariowhere a plurality of temp indexes (N) having key ranges between theplurality of temp indexes partially overlap. In an embodiment, if apredetermined number of temp indexes of the plurality of temp indexes(N) have an available storage capacity below a predetermined threshold,it may be determined whether the key ranges of at least two temp indexesof the plurality of temp indexes (N) are at least partially overlapped.If it is determined that at least two temp indexes have key ranges thatat least partially overlap, the at least two temp indexes may be mergedto form a merged index.

Referring specifically to FIG. 6, the first to the N^(th) temp indexesmay be full of index entries (denoted by “E”), and thus index entry 508may be added into the (N+1)^(th) temp index as shown by arrow(a). Thekey range of the first temp index 511 may be from 100 to 200. The keyrange of the second temp index 512 may be from 330 to 800. The key rangeof the fourth temp index 514 may be from 180 to 300. The key range ofthe fifth temp index 515 may be from 380 to 900. In this case, the keyranges of the first temp index 511 and the fourth temp index 514 arepartially overlapping, and the key ranges of the second temp index 512and the fifth temp index 515 are partially overlapping. Accordingly,first temp index 511 and fourth temp index 514 may be merged to form afirst merged index 611 (as shown by arrow(b)). Similarly, second tempindex 512 and fifth temp index 515 may be merged to form a second mergedindex 612 (as shown by arrow(c)).

The merged indexes 611 and 612 may be consolidated into index table 530(depicted in FIG. 5) asynchronously and/or in parallel. Afterconsolidation, whereby index entries included in merged index 611 andmerged index 612 are transferred to the index table (e.g., index table530), the merged indexes are dropped or otherwise deleted. As to theunmerged temp indexes of the N temp indexes, they may be similarlyconsolidated with the index table 530 asynchronously and/or in parallelwith respect to the merged indexes. After consolidation, whereby indexentries included in the unmerged temp indexes are transferred to theindex table (e.g., index table 530), index entries are deleted tothereby free up storage space on the unmerged temp indexes.

It should be appreciated that since two or more temp indexes may bemerged into a bigger merged index, the same index pages associated withthe two or more temp indexes may not need to be loaded into the bufferpool multiple times. In this way, the frequency of loading index pagesinto the buffer pool may be further reduced.

FIG. 7 depicts a schematic flowchart of a method for consolidating atleast one temp index into the index table of FIG. 4 in accordance withat least one embodiment of the present invention. More particularly,FIG. 7 illustrates an exemplary consolidation process of step 410 ofFIG. 4 in which at least one temp index is consolidated with an indextable.

At step 702, the index entries in each temp index having a key rangeacross at least two successive index pages are identified. For example,second temp index 512 (shown in FIG. 5) may actually have a key rangefrom 330 to 480 and 710 to 800. In this example, index page #3 of indextable 530 (shown in FIG. 5) may have a key range from 301 to 400.Similarly, index page #4 of index table 530 (shown in FIG. 5) may have akey range from 401 to 500. Likewise, index page #7 of index table 530(shown in FIG. 5) may have a key range from 701 to 800. Therefore, thekey range from 330 to 480 may be partially overlapping between twosuccessive index pages, index page #3 and index page #4. The indexentries having the key range from 330 to 480 may be identified. In thisway, the index entries in the respective temp indexes having the keyrange across at least two successive index pages may be identified inthis step.

At step 704, one or more index pages associated with the index entriesin each temp index are fetched from the index table. In the aboveexample, index page #3, index page #4, and index page #7 may be fetchedfrom index table 530 (shown in FIG. 5). However, if there are manysuccessive index pages (e.g., a number of successive index pages above apredetermined threshold or a number of successive index pages thatexceeds an amount of available free storage space in the buffer pool),then index pages associated with the identified index entries may befetched from the index table 530 in accordance with a priority levelassociated with the index pages. For example, index pages having ahigher priority level are fetched prior to index pages having a lowerpriority level.

At step 706, one by one, each temp index may be selected as a currentindex to be processed. In an embodiment, multiple temp indexes may alsobe selected and processed simultaneously.

At step 708, the identified index entries in the current index (i.e.,the current selected temp index) may be added into their associatedindex pages of the fetched index pages, and thus the fetched index pagesmay be updated accordingly. Since the time cost of adding index entriesinto successive index pages may be shorter than that of adding theseindex entries into nonconsecutive index pages, the time of theconsolidating action at step 410 may be reduced.

At step 710, the identified index entries may be deleted from thecurrent index.

At step 712, the undeleted index entries in the current index are addedinto their associated index pages of the fetched index pages, and thusthe fetched index pages may be updated accordingly. At step 714, theadded index entries are deleted from the current index.

At step 716, it is determined whether each temp index is processed. Ifevery temp index has not been processed (decision step 716 “N branch),the process returns to step 706 to process a next temp index.

If every temp index has been processed (decision step 716 “Y” branch),then the process proceeds to step 718 to merge the updated index pageswith the index table. Here, the updated index pages may replace thefetched index pages in the index table.

One of ordinary skill in the art will appreciate that the process 410may also be applied to the merged indexes as previously described withreference to FIG. 6, in which a merged index may be considered as alarger temp index.

It should be noted that the method 400 can support query functions. If aselect statement including a target key is received, the temp index thatis consolidated or merged with the index table may be locked, whichmeans consolidation or merging is paused. At this point, the index entryhaving the target key is searched within the available index entries ina temp index to find its corresponding RID. Next, the index entry havingthe target key is searched in the available index entries in the indextable to find its corresponding RID. Here, the available index entry mayrefer to one whose flag indicates the index entry is available.

What is claimed is:
 1. A computer-implemented method for managing anindex table associated with a data table, the method comprising:obtaining, in response to a current key in the data table being replacedwith a new key, a current index entry associated with the current keyfrom an index page of the index table; determining whether the indexpage associated with the current index entry is loaded in a buffer pool;adding, in response to determining that the index page associated withthe current index entry is not loaded in the buffer pool, a new indexentry associated with the new key into at least one temporary indexstored in the buffer pool; and consolidating, in response to the atleast one temporary index having an available storage capacity below apredetermined threshold, the at least one temporary index including thenew index entry with the index page of the index table.
 2. Thecomputer-implemented method of claim 1, wherein the at least onetemporary index includes a first temporary index and a second temporaryindex, and wherein: the new index entry is added into the secondtemporary index and the first temporary index is consolidated with theindex table in response to the first temporary index having an availablestorage capacity below a predetermined threshold.
 3. Thecomputer-implemented method of claim 1, wherein the at least onetemporary index includes a first temporary index and a second temporaryindex, and wherein consolidating the at least one temporary index withthe index table comprises, in response to each of the first and secondtemporary indexes having an available storage capacity below apredetermined threshold: merging, in response to key ranges of the firstand second temporary indexes being at least partially overlapping, thethe first and second temporary indexes into a merged index;consolidating index pages included in the merged index with the indextable; and deleting, in response to consolidating the index pagesincluded in the merged index with the index table, the merged indexes.4. The computer-implemented method of claim 1, wherein consolidating theat least one temporary index with the index table further comprises:identifying index entries in the at least one temporary index having akey range across at least two successive index pages; fetching from theindex table one or more index pages associated with the index entries inthe at least one temporary index, wherein the one or more index pagesincludes the index pages associated with the identified index entries;adding the identified index entries in the at least one temporary indexinto their associated index pages of the fetched index pages to updatethe fetched index pages; deleting the identified index entries from theat least one temporary index; adding any unidentified index entries inthe at least one temporary index into their associated index pages ofthe fetched index pages to update the fetched index pages; deleting theadded unidentified index entries from the at least one temporary index;and storing the updated index pages in the index table to replace thefetched index pages.
 5. The computer-implemented method of claim 1,further comprising: adding, in response to determining that the indexpage associated with the current index entry is not loaded in the bufferpool, the new index entry associated with the new key into a firsttemporary index stored in the buffer pool, and the current index entryassociated with the current key into a second temporary index stored inthe buffer pool.
 6. The computer-implemented method of claim 1, furthercomprising: obtaining the index entry based, at least in part, onexecuting one of a plurality of statements in a received log; readingthe plurality of statements from the received log; and storing theplurality of statements.
 7. The computer-implemented method of claim 1,further comprising: creating the one or more temporary indexes.
 8. Acomputer system for managing an index table associated with a datatable, the computer system comprising: one or more computer processors,one or more computer readable storage media, and program instructionsstored on the computer readable storage media for execution by at leastone of the one or more processors, the program instructions includinginstructions to: obtain, in response to a current key in the data tablebeing replaced with a new key, a current index entry associated with thecurrent key from an index page of the index table; determine whether theindex page associated with the current index entry is loaded in a bufferpool; add, in response to determining that the index page associatedwith the current index entry is not loaded in the buffer pool, a newindex entry associated with the new key into at least one temporaryindex stored in the buffer pool; and consolidate, in response to the atleast one temporary index having an available storage capacity below apredetermined threshold, the at least one temporary index including thenew index entry with the index page of the index table.
 9. The computersystem of claim 8, wherein the at least one temporary index includes afirst temporary index and a second temporary index, and wherein: the newindex entry is added into the second temporary index and the firsttemporary index is consolidated with the index table in response to thefirst temporary index having an available storage capacity below apredetermined threshold.
 10. The computer system of claim 8, the atleast one temporary index includes a first temporary index and a secondtemporary index, and wherein the program instructions to consolidate theat least one temporary index with the index table comprises, in responseto each of the first and second temporary indexes having an availablestorage capacity below a predetermined threshold, instructions to:merge, in response to key ranges of the first and second temporaryindexes being at least partially overlapping, the the first and secondtemporary indexes into a merged index; consolidate index pages includedin the merged index with the index table; and delete, in response toconsolidating the index pages included in the merged index with theindex table, the merged indexes.
 11. The computer system of claim 8,wherein consolidating the at least one temporary index with the indextable further comprises: identify index entries in the at least onetemporary index having a key range across at least two successive indexpages; fetch from the index table one or more index pages associatedwith the index entries in the at least one temporary index, wherein theone or more index pages includes the index pages associated with theidentified index entries; add the identified index entries in the atleast one temporary index into their associated index pages of thefetched index pages to update the fetched index pages; delete theidentified index entries from the at least one temporary index; add anyunidentified index entries in the at least one temporary index intotheir associated index pages of the fetched index pages to update thefetched index pages; delete the added unidentified index entries fromthe at least one temporary index; and store the updated index pages inthe index table to replace the fetched index pages.
 12. The computersystem of claim 8, further comprising program instructions to: add, inresponse to determining that the index page associated with the currentindex entry is not loaded in the buffer pool, the new index entryassociated with the new key into a first temporary index stored in thebuffer pool, and the current index entry associated with the current keyinto a second temporary index stored in the buffer pool.
 13. Thecomputer system of claim 8, wherein the program instructions furtherinclude instructions to: create the one or more temporary indexes.
 14. Acomputer program product for managing an index table associated with adata table, the computer program product including one or more computerreadable storage media and program instructions stored on the one ormore computer readable storage media, the program instructions includinginstructions to: obtain, in response to a current key in the data tablebeing replaced with a new key, a current index entry associated with thecurrent key from an index page of the index table; determine whether theindex page associated with the current index entry is loaded in a bufferpool; add, in response to determining that the index page associatedwith the current index entry is not loaded in the buffer pool, a newindex entry associated with the new key into at least one temporaryindex stored in the buffer pool; and consolidate, in response to the atleast one temporary index having an available storage capacity below apredetermined threshold, the at least one temporary index including thenew index entry with the index page of the index table.